
import unittest
from TarjanDirection import Directions

class DirectionsTest(unittest.TestCase):
    def testIncreaseDirection(self):
        """A direction increased, should be the direction turned clockwise"""
        assert Directions.north + 1 == Directions.east
        assert Directions.east + 1 == Directions.south
        assert Directions.south + 1 == Directions.west
        assert Directions.west + 1 == Directions.north
    def testDecreaseDirection(self):
        """A direction decreased, should be the direction turned counter-clockwise"""
        assert Directions.north - 1 == Directions.west
        assert Directions.west - 1 == Directions.south
        assert Directions.south - 1 == Directions.east
        assert Directions.east - 1 == Directions.north
    def testReverseDirection(self):
        """The inverse of a direction, should be the opposite direction"""
        assert ~Directions.north == Directions.south
        assert ~Directions.south == Directions.north
        assert ~Directions.east == Directions.west
        assert ~Directions.west == Directions.east
    def testIteration(self):
        """Directions should be iterable"""
        assert [str(dir) for dir in Directions] == ['north', 'east', 'south', 'west']

if __name__ == "__main__":
    unittest.main() 

